var beiMiCommon = require("BeiMiCommon");

cc.Class({
  extends: beiMiCommon,

  properties: {

    roomIdLabel: {
      default: null,
      type: cc.Label
    },

    totalLabel: {
      default: null,
      type: cc.Label
    },

    currentLabel: {
      default: null,
      type: cc.Label
    },

  },

  onLoad: function() {
         let self  = this;
        this.node.on('jiesan', function(event) {
          let socket = self.socket();
          var param = {
            token: cc.beimi.authorization,
            roomId:self.roomId,
            type:'9',
            versionNumber:cc.beimi.versionNumber
          };
          console.log("解散房间",JSON.stringify(param));
          socket.emit("leaveroom", JSON.stringify(param));
        });
  },

  init(data) {
    this.roomId = data.roomId;
    this.roomIdLabel.string = "房间号："+data.roomId;
    this.totalLabel.string = "总局数："+data.totalJun;
    this.currentLabel.string = "房间当前人数："+data.currentUserNum;
  },

});
